﻿<%@ Page Language="C#" MasterPageFile="~/GestorEventos.Master" AutoEventWireup="true" CodeBehind="listPalcos.aspx.cs" Inherits="GestorEventos.WebForm5" Title="Untitled Page" %>
<%@ Import Namespace="Business" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="UserArea" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Main" runat="server">
<table>
<%  ListaPalco  business = new ListaPalco();
    ListaPalco listaPalco = new ListaPalco();
    if (Request.QueryString["list"] != null) {
        int list = Convert.ToInt32(Request.QueryString["list"].ToString());
        if (list == 0 || list == 1 || list == 2)
        {
            listaPalco = new ListaPalco(business.getListaPalcos(list));
        }
    
    } else {
        
            listaPalco = new ListaPalco(business.getListaPalcos(-10));
    }

    System.Collections.Generic.List<Palco> lpalcos = listaPalco.getListaPalco();
    int i=0;
    while(i<lpalcos.Count+1)
    {
       
    %>
        <tr>
            <td>
                <asp:Label ID="LabelNome" runat="server"></asp:Label>
                <%if(i==lpalcos.Count)
                      LabelNome.Text = lpalcos[i-1].getNomePalco();
                  else
                      LabelNome.Text = lpalcos[i].getNomePalco(); %>
            </td>
            <td>
            <asp:HyperLink ID="HyperLink" runat="server"></asp:HyperLink>
            <%  HyperLink.Text = "Consultar";
                if(i==lpalcos.Count) 
                    HyperLink.NavigateUrl = "showPalco.aspx?palcoID=" + lpalcos[i-1].getIDPalco() + "";
                else
                    HyperLink.NavigateUrl = "showPalco.aspx?palcoID=" + lpalcos[i].getIDPalco() + ""; %>            
            </td>
            
            <td>
                <asp:Label ID="LabelStatus" runat="server"></asp:Label>
            <% 
                int st = 0;
                if (i == lpalcos.Count)
                    st = i - 1;
                else
                    st = i;            
                switch (lpalcos[st].getStatus())
                {
                    case 0: LabelStatus.Text = "Removido";
                        break;
                    case 1: LabelStatus.Text = "Aprovado";
                        break;
                    case 2: LabelStatus.Text = "Em revisão";
                        break;
                }%>
            </td>
        </tr>        
    <% i++;
    }
   // Response.Write("Last: " + lart[i - 1].getNomeArtista());
 %>
    </table>

</asp:Content>
